import { BooleanProperty, NumberProperty } from "xbsj-xe2/dist-node/xe2-base-objects";
import { PartialWithUndefinedReactivePropsToNativeProps, ReactivePropsToNativePropsAndChanged, extendClassProps, reactArray, reactArrayWithUndefined } from "xbsj-xe2/dist-node/xe2-base-utils";
import { SceneObjectKey } from "xbsj-xe2/dist-node/xe2-utils";
import { ESGeoExtrudedPolygonUFMS } from "../ESGeoExtrudedPolygonUFMS";

/**
 * 测试 ModelSer使用的挤压多边形体
 */
export class ESGeoExtrudedPolygonUFMSFromCircle extends ESGeoExtrudedPolygonUFMS {
    static override readonly type = this.register('ESGeoExtrudedPolygonUFMSFromCircle', this, { chsName: 'ModelSer使用的地理多边形体', tags: ['ESObjects', '_ES_Impl_Cesium', '_ES_Impl_UE'], description: "地理多边形体" });
    override get typeName() { return 'ESGeoExtrudedPolygonUFMSFromCircle'; }
    override get defaultProps() { return ESGeoExtrudedPolygonUFMSFromCircle.createDefaultProps(); }
    override get json() { return this._innerGetJson() as JsonType; }
    override set json(value: JsonType) { this._innerSetJson(value); }

    static override defaults = {
        ...ESGeoExtrudedPolygonUFMS.defaults,
        radius: 1,
        sides: 4
    }

    constructor(id?: SceneObjectKey) {
        super(id);
        this.collision = false;
    }
    override getESProperties() {
        const properties = { ...super.getESProperties() };
        return {
            ...properties,
            coordinate: [
                ...properties.coordinate,
                new NumberProperty('半径', '半径', true, false, [this, 'radius'], ESGeoExtrudedPolygonUFMSFromCircle.defaults.radius),
                new NumberProperty('边数', '边数', true, false, [this, 'sides'], ESGeoExtrudedPolygonUFMSFromCircle.defaults.sides),
                new BooleanProperty('编辑位置', '编辑位置', true, false, [this, 'positionEditing'], false)
            ]
        };
    };
    override getProperties(language: string) {
        return [
            ...super.getProperties(language),
            new NumberProperty('半径', '半径', true, false, [this, 'radius'], ESGeoExtrudedPolygonUFMSFromCircle.defaults.radius),
            new NumberProperty('边数', '边数', true, false, [this, 'sides'], ESGeoExtrudedPolygonUFMSFromCircle.defaults.sides),
            new BooleanProperty('编辑位置', '编辑位置', true, false, [this, 'positionEditing'], false)
        ];
    }
}

export namespace ESGeoExtrudedPolygonUFMSFromCircle {
    export const createDefaultProps = () => ({
        ...ESGeoExtrudedPolygonUFMS.createDefaultProps(),
        sides: undefined as number | undefined,
        radius: undefined as number | undefined,
        position: reactArrayWithUndefined<[number, number, number]>(undefined),
        rotation: reactArray<[number, number, number]>([0, 0, 0]),
        positionEditing: false,
    });
}
extendClassProps(ESGeoExtrudedPolygonUFMSFromCircle.prototype, ESGeoExtrudedPolygonUFMSFromCircle.createDefaultProps);
export interface ESGeoExtrudedPolygonUFMSFromCircle extends ReactivePropsToNativePropsAndChanged<ReturnType<typeof ESGeoExtrudedPolygonUFMSFromCircle.createDefaultProps>> { }
type JsonType = PartialWithUndefinedReactivePropsToNativeProps<ReturnType<typeof ESGeoExtrudedPolygonUFMSFromCircle.createDefaultProps> & { type: string }>;